﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="UserTypeFields.aspx.cs" Inherits="Atomic.Web.Pages.UserTypeFields" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="javascript">
        $(function () {
            var TypeID = '<%=Request["typeid"] %>';
            $('#userExtendFields').datagrid({
                url: '/Handlers/User/UserHandler.ashx/?method=GetUserExtendFields',
                method: 'post',
                toolbar: [
                    {
                        text: '新建',
                        iconCls: 'icon-add',
                        handler: function () {
                            $('#userTypeFieldEditBox').dialog('open');
                        }
                    }
                ],
                columns: [[
            		{ field: "ID", title: '编号', width: 80 },
            		{ field: "Name", title: '名称', width: 80 }
            	]],
                queryParams: {
                    UserTypeID: TypeID
                },
                onLoadSuccess: function () {
                }
            });

            $('#userTypeFieldEditBox').dialog({
                title: '新建/编辑属性',
                closed: true,
                buttons: [
                    {
                        text: '保存',
                        handler: function () {
                            $.post('/Handlers/User/UserHandler.ashx/?method=AddUserExtendField',
                            {
                                UserTypeID: TypeID,
                                Name: $('#txtName').val(),
                                DisplayName: $('#txtDisplayName').val(),
                                Comment: $('#txtComment').val(),
                                FieldType: $('#txtFieldType').val(),
                                Length: $('#txtLength').val()
                            },
                            function (data) {
                                if (data.Success) {
                                    $('#userTypeFieldEditBox').dialog('close');
                                    $('#userExtendFields').datagrid('load');
                                } else {
                                    $.messager.alert('提示信息', data.Message);
                                }
                            },
                            'json');
                        }
                    }
                ]
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="userExtendFields">
    </div>
    <table id="userTypeFieldEditBox" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                字段名称：<input type="text" id="txtName" />
            </td>
        </tr>
        <tr>
            <td>
                显示名称：<input type="text" id="txtDisplayName" />
            </td>
        </tr>
        <tr>
            <td>
                备注信息：<input type="text" id="txtComment" />
            </td>
        </tr>
        <tr>
            <td>
                字段类型：<input type="text" id="txtFieldType" />
            </td>
        </tr>
        <tr>
            <td>
                字段长度：<input type="text" id="txtLength" />
            </td>
        </tr>
    </table>
</asp:Content>
